package com.xmy.cultivate.schedule;

import com.xmy.cultivate.service.IStudentGradeHistoryService;
import com.xmy.cultivate.service.IStudentGradeService;
import com.xmy.cultivate.util.SpringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 添加分班信息到历史记录表
 */
public class AddStudentGradeHistoryJob implements Job {

    @Autowired
    IStudentGradeHistoryService iStudentGradeHistoryService = SpringUtils.getBean(IStudentGradeHistoryService.class);	;

    private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    private void before() {
        System.out.println("添加到分班历史表：开始执行-" + dateFormat.format(new Date()));
    }

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        before();
        System.out.println("添加到分班历史表：业务逻辑。。。");
        //iRecordCourseService = (IRecordCourseService) SpringContextJobUtil.getBean("iRecordCourseService");
        iStudentGradeHistoryService.addStudentGradeHistory(null,null,null,null);
        after();
    }

    private void after() {
        System.out.println("添加到分班历史表：执行结束");
        System.out.println();
    }
}
